package liming.tool.handle.net.tcp.base;

import liming.tool.handle.net.root.NetReceiveMap;
import liming.tool.handle.net.root.base.Transform;
import liming.tool.handle.net.tcp.socket.TcpReceiveMap;

public interface TransformTcp extends Transform {
    @Override
    default NetReceiveMap transform(NetReceiveMap netReceiveMap) {
        return transformTcp(netReceiveMap);
    }

    default TcpReceiveMap transformTcp(NetReceiveMap netReceiveMap) {
        if (netReceiveMap instanceof TcpReceiveMap) return (TcpReceiveMap) netReceiveMap;
        else return new TcpReceiveMap(netReceiveMap);
    }
}
